/
AuthenticationLoginBase.cs
78 lines (66 loc) · 3.17 KB
/
AuthenticationLoginBase.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information
namespace DotNetNuke.Services.Authentication
{
using System;
using System.Web;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Internal.SourceGenerators;
using DotNetNuke.Services.UserRequest;
/// <summary>
/// The AuthenticationLoginBase class provides a bas class for Authentication
/// Login controls.
/// </summary>
public abstract partial class AuthenticationLoginBase : UserModuleBase
{
/// <summary>Initializes a new instance of the <see cref="AuthenticationLoginBase"/> class.</summary>
protected AuthenticationLoginBase()
{
this.RedirectURL = Null.NullString;
this.AuthenticationType = Null.NullString;
this.Mode = AuthMode.Login;
}
public delegate void UserAuthenticatedEventHandler(object sender, UserAuthenticatedEventArgs e);
public event UserAuthenticatedEventHandler UserAuthenticated;
/// <summary>Gets a value indicating whether the control is Enabled.</summary>
/// <remarks>This property must be overriden in the inherited class.</remarks>
public abstract bool Enabled { get; }
/// <summary>Gets the IP address associated with the request.</summary>
public string IPAddress
{
get
{
var controller = UserRequestIPAddressController.Instance;
var request = new HttpRequestWrapper(HttpContext.Current.Request);
return controller.GetUserRequestIPAddress(request);
}
}
/// <summary>Gets a value indicating whether the control supports Registration.</summary>
/// <remarks>This property may be overriden in the inherited class.</remarks>
public virtual bool SupportsRegistration
{
get { return false; }
}
/// <summary>Gets or sets the Type of Authentication associated with this control.</summary>
public string AuthenticationType { get; set; }
/// <summary>Gets or sets the Authentication mode of the control (Login or Register).</summary>
/// <remarks>This property may be overriden in the inherited class.</remarks>
public virtual AuthMode Mode { get; set; }
/// <summary>Gets or sets the Redirect Url for this control.</summary>
public string RedirectURL { get; set; }
[DnnDeprecated(9, 2, 0, "Use UserRequestIPAddressController.Instance.GetUserRequestIPAddress")]
public static partial string GetIPAddress()
{
return UserRequestIPAddressController.Instance.GetUserRequestIPAddress(new HttpRequestWrapper(HttpContext.Current.Request));
}
protected virtual void OnUserAuthenticated(UserAuthenticatedEventArgs ea)
{
if (this.UserAuthenticated != null)
{
this.UserAuthenticated(null, ea);
}
}
}
}